package com.singlemountaintech.haogongjiang.http.api;

import com.singlemountaintech.haogongjiang.model.response.GetPublishBuild;
import com.singlemountaintech.haogongjiang.model.response.LoginModel;
import com.singlemountaintech.haogongjiang.model.response.PublishCraftsmanModel;
import com.singlemountaintech.haogongjiang.model.response.TokenModel;
import com.singlemountaintech.haogongjiang.qfd.constant.Keys;

import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.POST;
import retrofit2.http.Query;
import rx.Observable;

public interface ApiService {
    /*刷新token*/
    @POST("token/refresh")
    Call<TokenModel> refreshToken(@Header("refreshToken") String refreshToken);

    /*查询发布工地接口*/
    @GET("user/engineering/list?pageSize=" + Keys.HTTP_ROWS)
    Observable<GetPublishBuild> getBuildList(
            @Query("pageNo") int pageNo
    );

    /**
     * 登录
     *
     * @param username
     * @param password
     * @return
     */
    @FormUrlEncoded
    @POST("token/auth")
    Observable<LoginModel> login(
            @Field("username") String username,
            @Field("password") String password,
            @Field("withDetails") boolean withDetails

    );
    /*发布工匠———查询发布过的信息*/
    @GET("user/resume/findByUsername")
    Observable<PublishCraftsmanModel> findByUsername();
}
